/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-08-28
*/
package com.rzico.market.entity;

import com.rzico.basics.entity.Company;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * <pre>
 *   开票商品支付信息数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "mk_market_invoice_item")
public class InvoiceItem{
    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "创建日期" )
    protected Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected Date modifyDate;

    @JsonIgnore
    @ApiModelProperty(value = "是否删除" ,hidden = true )
    protected Boolean deleted;

    @ApiModelProperty(value = "开票状态(0:未开票,1:已完成)" )
    protected Boolean state;

    @ApiModelProperty(value = "开票ID" )
    protected Long invoiceId;

    @ApiModelProperty(value = "方式 {0:在线支付,1:线下收款,2:余额支付,3:会员卡支付}" )
    protected Integer method;

    @ApiModelProperty(value = "支付插件" )
    protected String paymentPluginId;

    @ApiModelProperty(value = "付款方式" )
    protected String paymentPluginName;

    @ApiModelProperty(value = "企业id" )
    protected Long companyId;

    @ApiModelProperty(value = "卡id" )
    protected Long cardId;

    @ApiModelProperty(value = "卡号" )
    protected String cardCode;

    @ApiModelProperty(value = "卡备注" )
    protected String cardMemo;

    @ApiModelProperty(value = "付款金额" )
    protected BigDecimal amount;

    @ApiModelProperty(value = "已开票金额" )
    protected BigDecimal invoiceAmount;

    @ApiModelProperty(value = "已开票数量" )
    protected BigDecimal outInvoiceQuantity;

    @ApiModelProperty(value = "归属企业" )
    protected Long enterpriseId;

    @JsonIgnore
    @ApiModelProperty(value = "创建者" ,hidden = true )
    protected String createBy;

    @JsonIgnore
    @ApiModelProperty(value = "更新者" ,hidden = true )
    protected String modifyBy;

    /**
     *  企业
     */
    @JsonIgnore
    @ApiModelProperty(value = "企业", hidden = true)
    protected Company company;

    public String getCompanyName() {
        Company company = getCompany();
        if (null != company){
            return company.getName();
        }else{
            return "";
        }
    }

}
